<?php
namespace xing\privacyPhone;

use xing\privacyPhone\drive\AliPrivacyPhone;
use xing\privacyPhone\drive\HuaWeiPrivacyPhone;

class PrivacyPhoneFactory
{

    private static $drive = [
        'Ali' => '\xing\privacyPhone\drive\AliPrivacyPhone',
        'HuaWei' => '\xing\privacyPhone\drive\HuaWeiPrivacyPhone',
    ];

    /**
     * 返回单例
     * @param $instanceName
     * @return AliPrivacyPhone|HuaWeiPrivacyPhone
     */
    public static function getInstance($instanceName)
    {
        static $class;
        if (isset($class[$instanceName])) return $class[$instanceName];
        return $class[$instanceName] = new self::$drive[$instanceName];
    }
}
